/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sessionbean;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import supportlearning.entities.Account;
import supportlearning.entities.StaffProfile;

/**
 *
 * @author Huy
 */
@Stateless
public class StaffProfileFacade extends AbstractFacade<StaffProfile> implements StaffProfileFacadeLocal {

    @PersistenceContext(unitName = "EprojectCMSSupportLearning-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public StaffProfileFacade() {
        super(StaffProfile.class);
    }

    public List<StaffProfile> findbysemid(int id) {
        Query q = em.createNamedQuery("StaffProfile.findBySemesterId");
        q.setParameter("semesterId", id);
        List<StaffProfile> liststaffpro = q.getResultList();
        return liststaffpro;
    }

    @Override
    public StaffProfile findStaffByID(String id) {
        return em.find(StaffProfile.class, id);
    }
}
